import Types from '../types'
import {apiUrl} from "../../../config";


/**
 * 获取课堂互动列表
 *
 */
export function fetchClassInteractions(params){
  return dispatch => {
    let url = `${apiUrl}/classContent/getClassContentList`;
    console.log(url)
    fetch(url, {
      method: "POST",
      headers: {
        'Content-Type': 'multipart/form-data',
        'token': '2c9eeeb789024442b185ed7854e84fa6',
      },
      body: params
    }).then(res => {
      console.log(res);
      return res.json();
    }).then((data) => {
      console.log(data)
      dispatch({
        type: Types.HOME_CLASS_INTERACTION_LOAD_SUCCESS,
        classInteraction: data.obj,
      })
      console.log('??')
    }).catch(error => {
      console.log(error)
      dispatch({
        type: Types.HOME_CLASS_INTERACTION_LOAD_FAIL,
        error
      })
    })
  }
}
